package com.xnyzc.lhy.common.penum.datascope;

/**
 * @Description 数据权限
 * @Author wangshuo
 * @Date 2019-08-17 19:53
 **/
public enum ESysDataScope {

    all(1, "所有数据"),
    containcompany(2, "所在公司及以下数据"),
    company(3, "所在公司数据"),
    containdept(4, "所在部门及以下数据"),
    dept(5, "所在部门数据"),
    oneself(8, "仅本人数据"),
    detail(9, "按明细设置");

    private Integer value;
    private String desc;

    ESysDataScope(Integer value, String desc){
        this.value = value;
        this.desc = desc;
    }

    public static ESysDataScope findById(Integer type) {
        ESysDataScope ePaymentType;
        switch (type) {
            case 1:
                ePaymentType = ESysDataScope.all;
                break;
            case 2:
                ePaymentType = ESysDataScope.containcompany;
                break;
            case 3:
                ePaymentType = ESysDataScope.company;
                break;
            case 4:
                ePaymentType = ESysDataScope.containdept;
                break;
            case 5:
                ePaymentType = ESysDataScope.dept;
                break;
            case 8:
                ePaymentType = ESysDataScope.oneself;
                break;
            case 9:
                ePaymentType = ESysDataScope.detail;
                break;
            default:
                throw new IllegalArgumentException("未设置");
        }
        return ePaymentType;
    }

    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }
}
